<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/layout.css" rel="stylesheet" type="text/css" />
<smart>include file ='../head.config.html'</smart>
<script type="text/javascript">
$().ready(function() {
	$('#icon_close_search_box').click(
		function(){ $('#filter').slideUp('slow',function(){$('#showcontr').slideDown('fast')})}
	);
	$('#showcontr').click(
		function(){ $('#showcontr').slideUp('fast',function(){$('#filter').slideDown('slow')})}
	);
	$(".tr_dotted").hover(function(){$(this).addClass("over")},function(){$(this).removeClass("over")});
	$('#negative').click(
		function(){
			$('#form_product input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
	)
	$('#offsale').click(
		function(){
			$('#form_product').attr("action", "own_product.php?action=update_state");
			$('#form_product').submit();
		}
	)
	$('#recommended').click(
		function(){
			//var str = $('#chboxPid').val();
			//alert(str);return false;
			$('#form_product').attr("action", "own_product.php?action=recommended");
			$('#form_product').submit();
		}
	)
	$('#cancel_recommended').click(
		function(){
			$('#form_product').attr("action", "own_product.php?action=cancel_recommended");
			$('#form_product').submit();
		}
	)

});

function update_storage(p_code){
	var storage = document.getElementById('p_storage_' + p_code).value;
	//alert(storage);
	$.ajax({
    	url: 'own_product.php?action=update_count',
    	type: 'post',
    	dataType: 'msg',
		data: 'txtPcode=' + p_code + '&txtPcount=' + storage,
    	timeout: 1000,
    	error: function(){
        	alert('something is wrong');
    	},
    	success: function(msg){
			//if(html == "ok"){
			alert('保存成功');
			window.location.reload();
			//}
        }
	});
}
</script>
</head>
<body>
<div id="container760"><smart>include file ='../header.html'</smart> <smart>include file ='../PathLinksLevel.html'</smart> <smart>include file ='own_menu.html'</smart>
  <div class="member_right">
    <div class="nav_top"><span>出售中的宝贝</span></div>
    <div class="box_F6F6F6">
      
	  <form action="own_product.php?action=<smart> if $state eq 1 </smart>list<smart> /if </smart><smart> if $state eq 0 </smart>listinstock<smart> /if </smart><smart> if $state eq 2 </smart>recommended_list<smart> /if </smart>" method="post" name="search_form">
        查询宝贝：
        <select name="searchtype">
          <option value="1" selected="selected">所有</option>
          <!--<option value="1">推荐的</option>
          <option value="-1">没有推荐的</option>-->
        </select>
        <input name="keyword" type="text" />
        <!--<input name="" type="checkbox" value="" />
        已出价
        <input name="" type="checkbox" value="" />
        参与会员折扣-->
        <input style=" font:12px/1.2em '宋体'" name="" type="submit" value="查询" />
      </form>
    </div>
    <form action="own_product.php?action=del" method="post" name="form_product" id="form_product">
      <table style="overflow:visible">
        <tr class="tr_FAFAFA">
          <th align="center" valign="middle">选择</th>
          <th align="center" valign="middle">&nbsp;</th>
          <th colspan="2" align="center" valign="middle">宝贝名称</th>
          <th align="center" valign="middle">数量</th>
          <smart> if $product_array[i].p_state=="0" </smart>
          <th align="center" valign="middle">剩余时间</th>
          <smart> /if </smart>
          <th align="center" valign="middle">当前价(原价)</th>
          <th align="center" valign="middle"><a href="#">出价<br />
          次数</a></th>
          <th align="center" valign="middle">编辑</th>
        </tr>
        <smart> section name=i loop=$product_array </smart>
        <tr class="tr_dotted">
          <td align="center" valign="middle"><input name="chboxPid[]" type="checkbox" value="<smart> $product_array[i].p_code </smart>"/>
		  		<input type="hidden" name="recommended_sign_<smart> $smarty.section.i.rownum </smart>" id="recommended_sign_<smart> $smarty.section.i.rownum </smart>" value="<smart> $product_array[i].p_recommended </smart>" />
		  </td>
          <td align="center" valign="middle"><smart> if $product_array[i].p_recommended == "1" </smart>推荐<smart> /if </smart></td>
          <td align="center" valign="middle"><a href="../home/product.php?action=view&pid=<smart> $product_array[i].p_code </smart>" target="_blank"><img src="../<smart> $product_array[i].p_pic|default:'templates/default/home/images/default.jpg' </smart>" border=0 class="p_pic70" width=100 /></a></td>
          <td align="center" valign="middle"><a href="../home/product.php?action=view&pid=<smart> $product_array[i].p_code </smart>" target="_blank"><smart> $product_array[i].p_name </smart></a></td>
          <td align="center" valign="middle" style="width:50px; text-align: center;"><input style=" font-family:'宋体'; line-height:1.1em; width:30px" name="p_storage_<smart> $product_array[i].p_code </smart>" id="p_storage_<smart> $product_array[i].p_code </smart>" value="<smart> $product_array[i].p_storage </smart>" />
          <input style=" font:12px/1.2em '宋体'" name="update_count" type="button" onclick="update_storage('<smart> $product_array[i].p_code </smart>');" value="保存" /></td>
            <smart> if $product_array[i].p_state!="0" </smart>
          <td align="center" valign="middle" style="width:70px; text-align: center;"><smart> $product_array[i].left_days </smart><smart> $langPday </smart><smart> $product_array[i].left_hours </smart><smart> $langPhour </smart><smart> $product_array[i].left_minutes </smart><smart> $langPminute </smart></td>
          <smart> /if </smart>
          <td align="center" valign="middle" style="width:45px; text-align: right;"><span class="fontred"><strong>/</strong></span><br />
          <smart> $product_array[i].p_price </smart>元</td>
          <td align="center" valign="middle" style="width:30px; text-align: center;"><smart> $product_array[i].p_sold_num|default:0 </smart></td>
          <td align="center" valign="middle" style=" text-align:center"><a href="own_product.php?action=modi&pid=<smart> $product_array[i].p_code </smart>" target="_blank"><img src="..<smart>$templatepath</smart>/member/images/edititem.gif" alt="<smart> $langhrfProductEdit </smart>" /></a></td>
        </tr>	 <div style="clear:both"></div>
        <smart> /section </smart>
		
      </table>
	  	 <div style="clear:both"></div>
      <div style="background:#ccc; padding:3px;">
      <smart> if $state == "1" </smart>
      <smart> assign var="button_value" value="下架" </smart>
      <input type="hidden" name="state" id="state" value="0">
      <smart> else </smart>
      <smart> assign var="button_value" value="上架" </smart>
      <input type="hidden" name="state" id="state" value="1">
      <smart> /if </smart>
        <input style=" font:12px/1.2em '宋体'" name="negative" type="button" id="negative" value="反选" />
        <input style=" font:12px/1.2em '宋体'" type="submit" name="Submit" value="<smart> $langbtnProductDel </smart>" />
        <input style=" font:12px/1.2em '宋体'" type="button" name="offsale" id="offsale" value="<smart> $button_value </smart>" />
        <smart> if $state == "1" </smart>
         <input style=" font:12px/1.2em '宋体'" type="button" name="recommended" id="recommended" value="橱窗推荐" />
         <input style=" font:12px/1.2em '宋体'" type="button" name="cancel_recommended" id="cancel_recommended" value="取消橱窗推荐" />
         <smart> /if </smart>
		 <div style="clear:both"></div>
      </div>
      <smart> $page_list </smart>
    </form>
		 <div style="clear:both"></div>
  </div>
 
  <smart>include file ='../footer.html'</smart>
   <div style="clear:both"></div>
  </div>
</body>
</html>
